﻿<%@ Page Language="C#" AutoEventWireup="true" Theme="Default" CodeBehind="FaPiaoFHJK.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS._8.QiTaGL.FaPiaoFHJK" %>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>发票返回接口</title>
    <script src="/JS/AddEditCancel.js"></script>
    <script src="/JS/jquery.js"></script>
    <script type="text/javascript">
        
       
        function rowClick() {
                if (gvList.GetFocusedRowIndex() != -1) {
                    hdCollection.Set("WJM", gvList.GetRowKey(gvList.GetFocusedRowIndex()));
                    gvRight.PerformCallback();
                    ASPxCallback1.PerformCallback("setlabel");
                }
            
        }

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            if (type == "setlabel") {
                var str = "共" + arr[2] + "条";
                zjl.SetText(str);
            }
        }

        //function Uploader_OnFileUploadComplete(e) {
        //    if (e.callbackData != "") {
        //        var vals = e.callbackData.split(",");
        //        if (vals[2] == "0") {
        //            alert("该文件已经导入，不能重复导入");
        //        }
        //        else if (vals[2] == "1") {
        //            alert(vals[0] + "上传成功！");
        //            gvGridTab3.PerformCallback();
        //        }
        //    }
        //}

        var typenum = 1;
        //开始上传文件
        //function Uploader_OnUploadStart() {
        //    //验证文件类型
        //    BtnDR.SetEnabled(false);
        //}
        var times = 0;
        function Uploader_OnFilesUploadComplete(e) {
            if (e.callbackData != "") {
                var vals = e.callbackData.split(",");
                if (vals[0] == "-1") {
                    alert("该文件导入失败！");
                }
                else if (vals[2] == "1") {
                    alert(vals[0] + "上传成功！");
                    gvList.PerformCallback();
                }
                else if (vals[2] == "2") {
                    alert(vals[0]);
                }
            }

            //if (args.isValid) {
            //    if (parseInt(args.callbackData) < 0) {
            //        alert('文件上传失败');
            //        BtnDR.SetEnabled(false);
            //    }
            //    else if (parseInt(args.callbackData) == 10) {
            //        BtnDR.SetEnabled(false);
            //        alert(args.callbackData.split('|')[1]);
            //    }
            //    else {

            //        BtnDR.SetEnabled(true);
            //        txtPath.SetText(args.callbackData.split('|')[0]);
            //        HidList.Set("path", args.callbackData.split('|')[1]);
            //        HidList.Set("IsHave", args.callbackData.split('|')[2]);
            //        return;
            //    }
            //}
        }

        //function DaoRu()
        //{
            
        //    if (HidList.Get("IsHave") == "" || HidList.Get("IsHave")==undefined)
        //    {
        //        alert("请上传文件");
        //        return;
        //    }
        //    if (parseInt(HidList.Get("IsHave")) > 0) {
        //        if (confirm("此文件已经存在,是否要重新导入")) {
        //            btnDaoRu.OnClick();
        //        }
        //    }
        //    else {
               
        //        btnDaoRu.OnClick();
        //    }
        //}
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div>
                     <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
                    <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback> 
                    <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="LoadPanel" runat="server"  Modal="true" Theme="Metropolis" ShowImage="false" Text="加载中"></dx:ASPxLoadingPanel>

                    <div class="tabletitle1" align="center">
                        发票返回接口
                    </div>
                    <table style="width: 100%">
                        <tr>
                            <td style="width: 80px" align="right">文件目录：
                            </td>
                            <%-- <td>
                               <dx:ASPxTextBox ID="txtPath" Width="100%" ReadOnly="true" ClientInstanceName="txtPath" runat="server">
                                </dx:ASPxTextBox>
                                <dx:ASPxHiddenField ID="HidList" ClientInstanceName="HidList" runat="server"></dx:ASPxHiddenField>
                            </td>--%>
                            <td style="width: 200px" colspan="2">
                                <%--<dx:ASPxUploadControl ID="UpLoadFile" runat="server" ClientInstanceName="uploader"
                                    ShowTextBox="false" Theme="Aqua" UploadMode="Standard" ShowClearFileSelectionButton="False"
                                    ShowProgressPanel="True" NullText="" OnFileUploadComplete="UpLoadFile_FileUploadComplete"
                                    Width="0px">
                                    <BrowseButton Text="选择"></BrowseButton>
                                    <ClientSideEvents FileUploadComplete="function(s, e) { Uploader_OnFileUploadComplete(e); }"
                                        TextChanged="function(s, e) { uploader.Upload();}"></ClientSideEvents>
                                    <ValidationSettings MaxFileSize="419430400" AllowedFileExtensions=".xls,.xlsx" NotAllowedFileExtensionErrorText="只能上传EXCEL文件">
                                    </ValidationSettings>
                                </dx:ASPxUploadControl>--%>

                                <dx:ASPxUploadControl ID="UpLoadFile" runat="server" ClientInstanceName="uploader"
                                    NullText="请选择文件" ShowTextBox="true" OnFileUploadComplete="UpLoadFile_FileUploadComplete"
                                    ShowClearFileSelectionButton="false" Theme="Aqua1" UploadMode="Advanced"
                                    Width="100%">
                                    <BrowseButton Text="选择并导入"></BrowseButton>
                                    <%--FilesUploadStart="function(){Uploader_OnUploadStart();}"--%>
                                    <ClientSideEvents TextChanged="function(s, e) { uploader.Upload();}" 
                                        FileUploadComplete="function(s, e) { Uploader_OnFilesUploadComplete(e); }" />
                                    <ValidationSettings AllowedFileExtensions=".xls,.xlsx" MaxFileSizeErrorText="2500000000" NotAllowedFileExtensionErrorText="只能上传EXCEL文件">
                                    </ValidationSettings>
                                </dx:ASPxUploadControl>
                                     <dx:ASPxHiddenField ID="HidList" ClientInstanceName="HidList" runat="server"></dx:ASPxHiddenField>

                            </td>
                            <td style="width: 10px"></td>
                            <%--<td style="width: 80px">
                                <dx:ASPxButton ID="ASPxButton1" ClientInstanceName="BtnDR"   runat="server" Text="导入" AutoPostBack="false"
                                    UseSubmitBehavior="false">
                                    <ClientSideEvents Click="function(s,e){DaoRu();}" />
                                </dx:ASPxButton>
                               
                            </td>--%>
                        </tr>

                    </table>
                    <div style=" display:none">
                       <%-- <dx:ASPxButton ID="btnBindRight" OnClick="btnBindRight_Click" ClientInstanceName="btnBindRight" runat="server" Text="查询"
                            UseSubmitBehavior="false">
                            <ClientSideEvents Click="function(s,e){LoadPanel.SetText('正在查询...');LoadPanel.Show();}" />
                        </dx:ASPxButton>--%>
                        <%-- <dx:ASPxButton ID="btnDaoRu" OnClick="btnDaoRu_Click" ClientInstanceName="btnDaoRu"  runat="server" Text="导入1"
                                    UseSubmitBehavior="false">
                                    <ClientSideEvents Click="function(s,e){LoadPanel.SetText('正在导入...');LoadPanel.Show();}" />
                                </dx:ASPxButton>--%>
                    </div>
                    <div id="divList" align="center">
                        <div>
                            <table style="width: 100%">
                                <tr>

                                    <td style="width: 30%" valign="top">
                                        <dx:ASPxGridView ID="gvList" ClientInstanceName="gvList" runat="server" KeyFieldName="S_FILENAME" Theme="Aqua1" Width="100%"
                                            AutoGenerateColumns="False" OnCustomCallback="gvList_CustomCallback">
                                            <Columns>
                                               
                                                <dx:GridViewDataTextColumn FieldName="S_FILENAME" Caption="文件名" Width="200">
                                                    <%-- <DataItemTemplate>
                                                        <asp:HiddenField ID="hid" runat="server" Value='<%#Eval("S_FILENAME") %>' />
                                                         <%#Eval("S_FILENAME") %>
                                                    </DataItemTemplate>--%>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="YM" Caption="年月" Width="50px">
                                                </dx:GridViewDataTextColumn>

                                            </Columns>
                                            <SettingsBehavior AllowSort="false" />
                                            <Settings VerticalScrollableHeight="400" VerticalScrollBarMode="Auto" />
                                            <ClientSideEvents  FocusedRowChanged="function(s,e){rowClick();}" />
                                            <%--<ClientSideEvents Init="function(s,e){AdjustSize(200,gvList);}" />--%>
                                        </dx:ASPxGridView>
                                    </td>

                                    <td valign="top">
                                        <dx:ASPxGridView ID="gvRight" SettingsBehavior-ProcessSelectionChangedOnServer="true" SettingsBehavior-AllowSort="false" 
                                            ClientInstanceName="gvRight" runat="server" AutoGenerateColumns="False" KeyFieldName="S_YONGHUH" Theme="Aqua1" Width="100%"
                                             OnCustomCallback="gvRight_CustomCallback">
                                            <Columns>
                                                <dx:GridViewDataTextColumn FieldName="I_Y" Caption="水量年" Width="50px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="I_M" Caption="水量月" Width="50px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="70">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="200">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="S_FAPIAOHM" Caption="发票号" Width="100">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="S_POSTFILE" Caption="邮件号码" Width="100">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="S_POSTDATE" Caption="配送日期" Width="75">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            <SettingsBehavior AllowSort="false" />
                                            <Settings VerticalScrollableHeight="400" VerticalScrollBarMode="Auto" />
                                            <%--<ClientSideEvents Init="function(s,e){AdjustSize(200,gvRight);}" />--%>
                                        </dx:ASPxGridView>

                                    </td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>
                                        <dx:ASPxLabel ID="zjl" ClientInstanceName="zjl" Text="共0条" runat="server" ForeColor="Blue"></dx:ASPxLabel>
                                    </td>

                                </tr>
                            </table>

                        </div>

                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
